package com.softsec.isc.analysis;
import java.io.DataInputStream;
import java.io.IOException;

public class GetFinal {

	 public static int GetSixteen(byte bufferArray[],int flag){
			int b1 = 0;
			 if(flag==1){
			  b1=(int) (((bufferArray[3]&0xff)<<24)|((bufferArray[2]&0xff)<<16)|((bufferArray[1]&0xff)<<8)|(bufferArray[0]&0xff));
			 }
			 else if(flag==0){
			  b1=(int) ((bufferArray[2]&0xff)<<16|(bufferArray[3]&0xff)<<16|(bufferArray[0]&0xff)|(bufferArray[1]&0xff)); 
			 }
			 return b1;
		 }
	 
	 public static int getFlag(String fileName) throws IOException{
		 DataInputStream input=apkExtractor.getDexDataInputStreamWithBuffered(fileName);	
		 int flag=0;	
		 int oct = Integer.parseInt("28", 16); 	 
		 byte[] bufferArray = new byte[4];
		 
		 input.skip(oct);   
		 input.read(bufferArray);
	     byte s1=bufferArray[0];
	     byte s2=bufferArray[1];
	     if(s1>s2){
	    	 flag=1;
	     }
	     input.close();
		return flag;
	}
	 
	 public static int getEight(byte bufferArray[]){
		 int b1=0;
		 b1=(int)(((bufferArray[1]&0xff)<<8)|(bufferArray[0]&0xff));
		 return b1;
	 }

	
}
